﻿package com.dcliment.jukebox.display.views
{
	import com.dcliment.display.gui.SimplePPButton;
	import com.dcliment.utils.TimeConverter;
	
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.text.TextField;
	
	/**
	 * This is connected to a MovieClip inside the fla that should have 3 items on the stage
	 * - mButton :: play pause button as a SimpleToggleButton
	 * - mTimer :: should be a dynamic textField
	 * 
	 * @author dcliment
	 * 
	 */	
	public class TimerView extends MovieClip
	{
		//
		private var _ppButton:SimplePPButton;
		private var _tTimer:TextField;
		
		public function TimerView()
		{
			_ppButton	= this["mButton"];
			_tTimer 	= this["mTimer"];
		
		}
		public function set time(value:Number):void
		{
			
			var n:String = TimeConverter.convertSecondsTo_MinsSec(value / 1000);
			
			_tTimer.text = n;
			
		}
		
		public function pauseState():void
		{
			_ppButton.pauseState();
		}
		public function playState():void
		{
			_ppButton.playState();
		}
		
		public function get playPauseButton():SimplePPButton
		{
			return _ppButton;
		}
	}
}